Reply to this topicStart new topicStart Poll

Outline · [ Standard ] · Linear+

> TES AddItem bug workaround, Or: How to make an ingredients chest

_aragon
post Jan 19 2005, 08:08 AM
Post #1


Novice


Joined: 16-January 05
From: Netherlands



Hi all,

For my TelMagus plugin I had to create a workaround for the dreaded "AddItem" bug in morrowind to make a reliable ingredients chest.

Here is the problem: the "AddItem" call can add items to containers. However, if the container has been emptied in game by the player, the "AddItem" call will no longer work. GhanBuriGhan's guide says that the only fix is to delete the container and place a new one -- but one can not check whether the container was empty or not!

The workaround is to attach a script to the container that always adds and removes a dummy item in the same frame that the player activated it. So, my ingredients chest has a script that looks like:

; Open the chest
Activate

; Always add and remove a dummy (this hack keeps the "AddItem" calls working)
AddItem, "misc_de_cloth10", 1
RemoveItem, "misc_de_cloth10", 1

Furthermore, we make the chest with "references persist". Now we can reference it from an ingredients sorter using code like:

set count to ( player->GetItemCount, "ingred_dreugh_wax_01" )
while ( count > 0 )
set count to ( count - 1 )
player->RemoveItem, "ingred_dreugh_wax_01", 1
"_tm_ingredients_chest"->AddItem, "ingred_dreugh_wax_01", 1
endwhile

Ok, have fun with your own ingredients chests,
-- Aragon
TopReport Post
User is offlinePM
+Quote Post
_aragon
post Jan 20 2005, 03:24 PM
Post #2


Novice


Joined: 16-January 05
From: Netherlands



A little bump before this great workaround gets forgotten forever :)
TopReport Post
User is offlinePM
+Quote Post
Nigedo
post Jan 20 2005, 03:35 PM
Post #3


Diviner
***

Joined: 29-May 03
From: Bethamez, Handfast Hall



Sounds cool, this bug has been the bane of container scripting forever.

Can we see the whole script please Aragon?


--------------------
TopReport Post
User is online!PMEmail Poster
+Quote Post
PirateLord
post Jan 20 2005, 04:41 PM
Post #4


Disciple
**

Joined: 7-October 03
From: Earth, some of the time



I just added some gold pieces to my containers, which is fine, since if the players nicks the gold too, it disables the script, which is just perfect :)

Good workaround though.


--------------------
Vist my Morrowind Mods page
Piratelords Mods

Greater Dwemer Ruins Forum


(If I get asked one more time "Is it Compatable with MCA", I'm gonna get so angry that I'll make Dagoth Ur look like a Mud-Crab, grrrrr.....)
TopReport Post
User is offlinePMEmail Poster
+Quote Post

Fast ReplyReply to this topicTopic OptionsStart new topic
1 User(s) are reading this topic (0 Guests and 1 Anonymous Users)
0 Members:

 

Lo-Fi Version 0.1692sec    --    9 queries    GZIP Enabled
Time is now: 15th February 2005 - 11:33 PM